#ifndef SECUREDATAMAP_H
#define SECUREDATAMAP_H
#include <botan/secmem.h>
#include <QStringList>
#include <map>

#include "securedatamapitem.h"
#include "ciphermanager.h"
namespace crypto {
class SecureDataMap {
public:
	SecureDataMap(std::shared_ptr<cipherManager> manager);

	SecureDataMap(const SecureDataMap& map) = default;

	void addItemBySecureDataItem(SecureDataMapItem&& item);

	void addItemBySecureDataItem(const SecureDataMapItem& item);

	void addItemByStrings(const std::string& service, const std::string& login,
						  std::string unecryptedPassword, std::string unecryptedData);

	std::vector<SecureDataMapItem>::const_iterator getData(const std::string& login) const;

	std::vector<SecureDataMapItem>::iterator getDataViaLoginAndServiceName(const std::string &login,
		const std::string &service);

	void clearData();

	std::size_t count() const;

	void deleteItemByLogin(const std::string& login);

	void deleteItem(std::vector<SecureDataMapItem>::const_iterator iter);

	std::vector<SecureDataMapItem>::iterator begin();

	std::vector<SecureDataMapItem>::iterator end();

	std::vector<SecureDataMapItem>::const_iterator begin() const;

	std::vector<SecureDataMapItem>::const_iterator end() const;

	std::shared_ptr<cipherManager> getCipherManager() const;

	Botan::secure_vector<uint8_t> writeMapInSecureVector();


private:
	std::vector<SecureDataMapItem> data;
	std::shared_ptr<cipherManager> manager;

};
}
#endif // SECUREDATAMAP_H
